package cn.lbwfree.day3_25;

import java.util.Scanner;

/**
 * @date:2020年3月25日
 * @author:lbwfree
 * number:BASIC-18 矩形面积交
 */
public class RectangleArea {
	public static void main(String[] args) {
		Scanner inScanner = new Scanner(System.in);
		
		//四个数设为[Xmin,Hmin,Xmax,Hmax]
		double Xmin,Hmin,Xmax,Hmax,temp;
		//两个矩形
		double[] area1;
		double[] area2;
		//第一个矩形
		Xmin =inScanner.nextDouble();
		Hmin =inScanner.nextDouble();
		temp =inScanner.nextDouble();
		if(temp>=Xmin)
		{
			Xmax=temp;
		}else {
			Xmax=Xmin;
			Xmin=temp;
		}
		temp =inScanner.nextDouble();
		if(temp>=Hmin)
		{
			Hmax=temp;
		}else {
			Hmax=Hmin;
			Hmin=temp;
		}
		area1=new double[]{Xmin,Hmin,Xmax,Hmax};
		//第二个矩形
		Xmin =inScanner.nextDouble();
		Hmin =inScanner.nextDouble();
		temp =inScanner.nextDouble();
		if(temp>=Xmin)
		{
			Xmax=temp;
		}else {
			Xmax=Xmin;
			Xmin=temp;
		}
		temp =inScanner.nextDouble();
		if(temp>=Hmin)
		{
			Hmax=temp;
		}else {
			Hmax=Hmin;
			Hmin=temp;
		}
		area2=new double[]{Xmin,Hmin,Xmax,Hmax};
		//知道平行坐标轴中(x,y)等于(W,H)
		double[] area = new double[4];
		
		//交叉的面积是两个矩形的低边的高的，高边的低的。平行x，y同理
		area[0]=area1[0]>area2[0]?area1[0]:area2[0];
		area[1]=area1[1]>area2[1]?area1[1]:area2[1];
		area[2]=area1[2]<area2[2]?area1[2]:area2[2];
		area[3]=area1[3]<area2[3]?area1[3]:area2[3];
		// 有交叉矩形
		if(area[0]<area[2]&&area[1]<area[3])
		{
			System.out.println(String.format("%.2f", (area[3]-area[1])*(area[2]-area[0])));
		}else {
			System.out.println("0.00");
		}
		
	}

}
